package com.janj.controller;

import com.github.pagehelper.PageInfo;
import com.janj.bean.Hero;
import com.janj.service.HeroService;
import com.janj.service.HeroServiceImpl;
import org.junit.Test;

import java.util.List;

//英雄测试类
public class HeroDemo {


    @Test
    public void teseSelectAll(){

        HeroService service = new HeroServiceImpl();
        List<Hero> array = service.selectAll();
        System.out.println("-------------");
        for (Hero h : array) {
            System.out.println(h);
        }
        //===============
        //创建PageInfo 的对象,将集合 array 作为参数传入
        PageInfo<Hero> info = new PageInfo<>(array);

        System.out.println("总条数"+info.getTotal());
        System.out.println("总页数"+info.getPages());
        System.out.println("当前页数"+info.getPageNum());
        System.out.println("每一页显示条数"+info.getPageSize());
        System.out.println();
        System.out.println("前一页" + info.getPrePage());
        System.out.println("后一页"+info.getNextPage());
        System.out.println("是否是第一页" + info.isIsFirstPage());
        System.out.println("是否是最后一页"+ info.isIsLastPage());


    }
}
